home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 242 / Issue 242 - April 2008 - DPCS0408DVD.ISO / Software Money Savers / VirtualDub / Source / VirtualDub-1.7.7-src.7z / src / Priss / source / layer3tables.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2006-03-14  |  40.8 KB  |  761 lines

  1. //    Priss (NekoAmp 2.0) - MPEG-1/2 audio decoding library
  2. //    Copyright (C) 2003 Avery Lee
  3. //
  4. //    This program is free software; you can redistribute it and/or modify
  5. //    it under the terms of the GNU General Public License as published by
  6. //    the Free Software Foundation; either version 2 of the License, or
  7. //    (at your option) any later version.
  8. //
  9. //    This program is distributed in the hope that it will be useful,
  10. //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. //    GNU General Public License for more details.
  13. //
  14. //    You should have received a copy of the GNU General Public License
  15. //    along with this program; if not, write to the Free Software
  16. //    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17.  
  18. #include <vd2/system/vdtypes.h>
  19. #include <windows.h>
  20. #include "engine.h"
  21. #include "bitreader.h"
  22.  
  23. namespace {
  24.     const struct HuffQuad {
  25.         sint8 x, y;
  26.         uint8 bits;
  27.         uint8 _pad;
  28.     } hufftbl_1_fast[32]={    // maximum: 5 bits
  29.         /* 00000 */ { +1, +1, 5 },
  30.         /* 00001 */ { +1, -1, 5 },
  31.         /* 00010 */ { -1, +1, 5 },
  32.         /* 00011 */ { -1, -1, 5 },
  33.         /* 0010x */ {  0, +1, 4 },    { 0, +1, 4 },
  34.         /* 0011x */ {  0, -1, 4 },    { 0, -1, 4 },
  35.         /* 010xx */ { +1,  0, 3 },    { +1,  0, 3 },    { +1,  0, 3 },    { +1,  0, 3 },
  36.         /* 011xx */ { -1,  0, 3 },    { -1,  0, 3 },    { -1,  0, 3 },    { -1,  0, 3 },
  37.         /* 1xxxx */ {  0,  0, 1 },    {  0,  0, 1 },    {  0,  0, 1 },    {  0,  0, 1 },
  38.                     {  0,  0, 1 },    {  0,  0, 1 },    {  0,  0, 1 },    {  0,  0, 1 },
  39.                     {  0,  0, 1 },    {  0,  0, 1 },    {  0,  0, 1 },    {  0,  0, 1 },
  40.                     {  0,  0, 1 },    {  0,  0, 1 },    {  0,  0, 1 },    {  0,  0, 1 },
  41.     }, hufftbl_2_lo[28]={
  42.         /* 00100 */    { +1, +1, 5 },
  43.         /* 00101 */    { +1, -1, 5 },
  44.         /* 00110 */    { -1, +1, 5 },
  45.         /* 00111 */    { -1, -1, 5 },
  46.         /* 0100x */ {  0, +1, 4 },    {  0, +1, 4 },
  47.         /* 0101x */ {  0, -1, 4 },    {  0, -1, 4 },
  48.         /* 0110x */ { +1,  0, 4 },    { +1,  0, 4 },
  49.         /* 0111x */ { -1,  0, 4 },    { -1,  0, 4 },
  50.         /* 1xxxx */    {  0,  0, 1 },    {  0,  0, 1 },    {  0,  0, 1 },    {  0,  0, 1 },
  51.                     {  0,  0, 1 },    {  0,  0, 1 },    {  0,  0, 1 },    {  0,  0, 1 },
  52.                     {  0,  0, 1 },    {  0,  0, 1 },    {  0,  0, 1 },    {  0,  0, 1 },
  53.                     {  0,  0, 1 },    {  0,  0, 1 },    {  0,  0, 1 },    {  0,  0, 1 },
  54.     }, hufftbl_2_3_hi[32]={
  55.         /* 00000000 */ { +2, +2, 8 },
  56.         /* 00000001 */ { +2, -2, 8 },
  57.         /* 00000010 */ { -2, +2, 8 },
  58.         /* 00000011 */ { -2, -2, 8 },
  59.         /* 0000010x */ {  0, +2, 7 }, {  0, +2, 7 },
  60.         /* 0000011x */ {  0, -2, 7 }, {  0, -2, 7 },
  61.         /* 0000100x */ { +1, +2, 7 }, { +1, +2, 7 },
  62.         /* 0000101x */ { +1, -2, 7 }, { +1, -2, 7 },
  63.         /* 0000110x */ { -1, +2, 7 }, { -1, +2, 7 },
  64.         /* 0000111x */ { -1, -2, 7 }, { -1, -2, 7 },
  65.         /* 0001000x */ { +2, +1, 7 }, { +2, +1, 7 },
  66.         /* 0001001x */ { +2, -1, 7 }, { +2, -1, 7 },
  67.         /* 0001010x */ { -2, +1, 7 }, { -2, +1, 7 },
  68.         /* 0001011x */ { -2, -1, 7 }, { -2, -1, 7 },
  69.         /* 000110xx */ { +2,  0, 6 }, { +2,  0, 6 }, { +2,  0, 6 }, { +2,  0, 6 },
  70.         /* 000111xx */ { -2,  0, 6 }, { -2,  0, 6 }, { -2,  0, 6 }, { -2,  0, 6 },
  71.     }, hufftbl_3_lo[14]={
  72.         /* 0010 */    { +1,  0, 4 },
  73.         /* 0011 */    { -1,  0, 4 },
  74.         /* 0100 */    { +1, +1, 4 },
  75.         /* 0101 */    { +1, -1, 4 },
  76.         /* 0110 */    { -1, +1, 4 },
  77.         /* 0111 */    { -1, -1, 4 },
  78.         /* 100x */    {  0, +1, 3 }, {  0, +1, 3 },
  79.         /* 101x */    {  0, -1, 3 }, {  0, -1, 3 },
  80.         /* 11xx */    {  0,  0, 2 }, {  0,  0, 2 },
  81.                     {  0,  0, 2 }, {  0,  0, 2 },
  82.     }, hufftbl_5_hi[28]={
  83.         /* 001xx */    { +1, +1, 5 }, { +1, -1, 5 }, { -1, +1, 5 }, { -1, -1, 5 },
  84.         /* 010xx */    {  0, +1, 4 }, {  0, +1, 4 }, {  0, -1, 4 }, {  0, -1, 4 },
  85.         /* 011xx */ { +1,  0, 4 }, { +1,  0, 4 }, { -1,  0, 4 }, { -1,  0, 4 },
  86.         /* 1xxxx */ {  0,  0, 1 }, {  0,  0, 1 }, {  0,  0, 1 }, {  0,  0, 1 },
  87.                     {  0,  0, 1 }, {  0,  0, 1 }, {  0,  0, 1 }, {  0,  0, 1 },
  88.                     {  0,  0, 1 }, {  0,  0, 1 }, {  0,  0, 1 }, {  0,  0, 1 },
  89.                     {  0,  0, 1 }, {  0,  0, 1 }, {  0,  0, 1 }, {  0,  0, 1 },
  90.     }, hufftbl_6_hi[54]={
  91.         /* 00101x */    {  0, +2, 6 }, {  0, -2, 6 },
  92.         /* 0011xx */    { +1, +2, 6 }, { +1, -2, 6 }, { -1, +2, 6 }, { -1, -2, 6 },
  93.         /* 0100xx */    { +2, +1, 6 }, { +2, -1, 6 }, { -2, +1, 6 }, { -2, -1, 6 },
  94.         /* 0101xx */    { +2,  0, 5 }, { +2,  0, 5 }, { -2,  0, 5 }, { -2,  0, 5 },
  95.         /* 011xxx */    {  0, +1, 4 }, {  0, +1, 4 }, {  0, +1, 4 }, {  0, +1, 4 },
  96.                         {  0, -1, 4 }, {  0, -1, 4 }, {  0, -1, 4 }, {  0, -1, 4 },
  97.         /* 10xxxx */    { +1, +1, 4 }, { +1, +1, 4 }, { +1, +1, 4 }, { +1, +1, 4 },
  98.                         { +1, -1, 4 }, { +1, -1, 4 }, { +1, -1, 4 }, { +1, -1, 4 },
  99.                         { -1, +1, 4 }, { -1, +1, 4 }, { -1, +1, 4 }, { -1, +1, 4 },
  100.                         { -1, -1, 4 }, { -1, -1, 4 }, { -1, -1, 4 }, { -1, -1, 4 },
  101.         /* 110xxx */    { +1,  0, 4 }, { +1,  0, 4 }, { +1,  0, 4 }, { +1,  0, 4 },
  102.                         { -1,  0, 4 }, { -1,  0, 4 }, { -1,  0, 4 }, { -1,  0, 4 },
  103.         /* 111xxx */    {  0,  0, 3 }, {  0,  0, 3 }, {  0,  0, 3 }, {  0,  0, 3 },
  104.                         {  0,  0, 3 }, {  0,  0, 3 }, {  0,  0, 3 }, {  0,  0, 3 },
  105.     };
  106.  
  107.     // These are trees from the reference code -- each node either holds
  108.     // relative positive offsets for the next bit '0' or '1', or the
  109.     // left branch is 0 and the right branch holds (x<<4)+y.
  110.  
  111.     static const uint8 table1[][2]={
  112.     0x02,0x01,0x00,0x00,0x02,0x01,0x00,0x10,0x02,0x01,0x00,0x01,0x00,0x11 
  113.     };
  114.  
  115.     static const uint8 table2[][2]={
  116.     0x02,0x01,0x00,0x00,0x04,0x01,0x02,0x01,0x00,0x10,0x00,0x01,0x02,0x01,0x00,0x11,0x04,0x01,0x02,0x01,0x00,0x20,0x00,0x21, 
  117.     0x02,0x01,0x00,0x12,0x02,0x01,0x00,0x02,0x00,0x22,
  118.     };
  119.  
  120.     static const uint8 table3[][2]={
  121.     0x04,0x01,0x02,0x01,0x00,0x00,0x00,0x01,0x02,0x01,0x00,0x11,0x02,0x01,0x00,0x10,0x04,0x01,0x02,0x01,0x00,0x20,0x00,0x21, 
  122.     0x02,0x01,0x00,0x12,0x02,0x01,0x00,0x02,0x00,0x22, 
  123.     };
  124.  
  125.     static const uint8 table5[][2]={
  126.     0x02,0x01,0x00,0x00,0x04,0x01,0x02,0x01,0x00,0x10,0x00,0x01,0x02,0x01,0x00,0x11,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0x20, 
  127.     0x00,0x02,0x02,0x01,0x00,0x21,0x00,0x12,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0x22,0x00,0x30,0x02,0x01,0x00,0x03,0x00,0x13, 
  128.     0x02,0x01,0x00,0x31,0x02,0x01,0x00,0x32,0x02,0x01,0x00,0x23,0x00,0x33, 
  129.     };
  130.  
  131.     static const uint8 table6[][2]={
  132.     0x06,0x01,0x04,0x01,0x02,0x01,0x00,0x00,0x00,0x10,0x00,0x11,0x06,0x01,0x02,0x01,0x00,0x01,0x02,0x01,0x00,0x20,0x00,0x21, 
  133.     0x06,0x01,0x02,0x01,0x00,0x12,0x02,0x01,0x00,0x02,0x00,0x22,0x04,0x01,0x02,0x01,0x00,0x31,0x00,0x13,0x04,0x01,0x02,0x01, 
  134.     0x00,0x30,0x00,0x32,0x02,0x01,0x00,0x23,0x02,0x01,0x00,0x03,0x00,0x33, 
  135.     };
  136.  
  137.     static const uint8 table7[][2]={
  138.     0x02,0x01,0x00,0x00,0x04,0x01,0x02,0x01,0x00,0x10,0x00,0x01,0x08,0x01,0x02,0x01,0x00,0x11,0x04,0x01,0x02,0x01,0x00,0x20, 
  139.     0x00,0x02,0x00,0x21,0x12,0x01,0x06,0x01,0x02,0x01,0x00,0x12,0x02,0x01,0x00,0x22,0x00,0x30,0x04,0x01,0x02,0x01,0x00,0x31, 
  140.     0x00,0x13,0x04,0x01,0x02,0x01,0x00,0x03,0x00,0x32,0x02,0x01,0x00,0x23,0x00,0x04,0x0a,0x01,0x04,0x01,0x02,0x01,0x00,0x40, 
  141.     0x00,0x41,0x02,0x01,0x00,0x14,0x02,0x01,0x00,0x42,0x00,0x24,0x0c,0x01,0x06,0x01,0x04,0x01,0x02,0x01,0x00,0x33,0x00,0x43, 
  142.     0x00,0x50,0x04,0x01,0x02,0x01,0x00,0x34,0x00,0x05,0x00,0x51,0x06,0x01,0x02,0x01,0x00,0x15,0x02,0x01,0x00,0x52,0x00,0x25, 
  143.     0x04,0x01,0x02,0x01,0x00,0x44,0x00,0x35,0x04,0x01,0x02,0x01,0x00,0x53,0x00,0x54,0x02,0x01,0x00,0x45,0x00,0x55, 
  144.     };
  145.  
  146.     static const uint8 table8[][2]={
  147.     0x06,0x01,0x02,0x01,0x00,0x00,0x02,0x01,0x00,0x10,0x00,0x01,0x02,0x01,0x00,0x11,0x04,0x01,0x02,0x01,0x00,0x21,0x00,0x12, 
  148.     0x0e,0x01,0x04,0x01,0x02,0x01,0x00,0x20,0x00,0x02,0x02,0x01,0x00,0x22,0x04,0x01,0x02,0x01,0x00,0x30,0x00,0x03,0x02,0x01, 
  149.     0x00,0x31,0x00,0x13,0x0e,0x01,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0x32,0x00,0x23,0x02,0x01,0x00,0x40,0x00,0x04,0x02,0x01, 
  150.     0x00,0x41,0x02,0x01,0x00,0x14,0x00,0x42,0x0c,0x01,0x06,0x01,0x02,0x01,0x00,0x24,0x02,0x01,0x00,0x33,0x00,0x50,0x04,0x01, 
  151.     0x02,0x01,0x00,0x43,0x00,0x34,0x00,0x51,0x06,0x01,0x02,0x01,0x00,0x15,0x02,0x01,0x00,0x05,0x00,0x52,0x06,0x01,0x02,0x01, 
  152.     0x00,0x25,0x02,0x01,0x00,0x44,0x00,0x35,0x02,0x01,0x00,0x53,0x02,0x01,0x00,0x45,0x02,0x01,0x00,0x54,0x00,0x55, 
  153.     };
  154.  
  155.     static const uint8 table9[][2]={
  156.     0x08,0x01,0x04,0x01,0x02,0x01,0x00,0x00,0x00,0x10,0x02,0x01,0x00,0x01,0x00,0x11,0x0a,0x01,0x04,0x01,0x02,0x01,0x00,0x20, 
  157.     0x00,0x21,0x02,0x01,0x00,0x12,0x02,0x01,0x00,0x02,0x00,0x22,0x0c,0x01,0x06,0x01,0x04,0x01,0x02,0x01,0x00,0x30,0x00,0x03, 
  158.     0x00,0x31,0x02,0x01,0x00,0x13,0x02,0x01,0x00,0x32,0x00,0x23,0x0c,0x01,0x04,0x01,0x02,0x01,0x00,0x41,0x00,0x14,0x04,0x01, 
  159.     0x02,0x01,0x00,0x40,0x00,0x33,0x02,0x01,0x00,0x42,0x00,0x24,0x0a,0x01,0x06,0x01,0x04,0x01,0x02,0x01,0x00,0x04,0x00,0x50, 
  160.     0x00,0x43,0x02,0x01,0x00,0x34,0x00,0x51,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0x15,0x00,0x52,0x02,0x01,0x00,0x25,0x00,0x44, 
  161.     0x06,0x01,0x04,0x01,0x02,0x01,0x00,0x05,0x00,0x54,0x00,0x53,0x02,0x01,0x00,0x35,0x02,0x01,0x00,0x45,0x00,0x55, 
  162.     };
  163.  
  164.     static const uint8 table10[][2]={
  165.     0x02,0x01,0x00,0x00,0x04,0x01,0x02,0x01,0x00,0x10,0x00,0x01,0x0a,0x01,0x02,0x01,0x00,0x11,0x04,0x01,0x02,0x01,0x00,0x20, 
  166.     0x00,0x02,0x02,0x01,0x00,0x21,0x00,0x12,0x1c,0x01,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0x22,0x00,0x30,0x02,0x01,0x00,0x31, 
  167.     0x00,0x13,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0x03,0x00,0x32,0x02,0x01,0x00,0x23,0x00,0x40,0x04,0x01,0x02,0x01,0x00,0x41, 
  168.     0x00,0x14,0x04,0x01,0x02,0x01,0x00,0x04,0x00,0x33,0x02,0x01,0x00,0x42,0x00,0x24,0x1c,0x01,0x0a,0x01,0x06,0x01,0x04,0x01, 
  169.     0x02,0x01,0x00,0x50,0x00,0x05,0x00,0x60,0x02,0x01,0x00,0x61,0x00,0x16,0x0c,0x01,0x06,0x01,0x04,0x01,0x02,0x01,0x00,0x43, 
  170.     0x00,0x34,0x00,0x51,0x02,0x01,0x00,0x15,0x02,0x01,0x00,0x52,0x00,0x25,0x04,0x01,0x02,0x01,0x00,0x26,0x00,0x36,0x00,0x71, 
  171.     0x14,0x01,0x08,0x01,0x02,0x01,0x00,0x17,0x04,0x01,0x02,0x01,0x00,0x44,0x00,0x53,0x00,0x06,0x06,0x01,0x04,0x01,0x02,0x01, 
  172.     0x00,0x35,0x00,0x45,0x00,0x62,0x02,0x01,0x00,0x70,0x02,0x01,0x00,0x07,0x00,0x64,0x0e,0x01,0x04,0x01,0x02,0x01,0x00,0x72, 
  173.     0x00,0x27,0x06,0x01,0x02,0x01,0x00,0x63,0x02,0x01,0x00,0x54,0x00,0x55,0x02,0x01,0x00,0x46,0x00,0x73,0x08,0x01,0x04,0x01, 
  174.     0x02,0x01,0x00,0x37,0x00,0x65,0x02,0x01,0x00,0x56,0x00,0x74,0x06,0x01,0x02,0x01,0x00,0x47,0x02,0x01,0x00,0x66,0x00,0x75, 
  175.     0x04,0x01,0x02,0x01,0x00,0x57,0x00,0x76,0x02,0x01,0x00,0x67,0x00,0x77, 
  176.     };
  177.  
  178.     static const uint8 table11[][2]={
  179.     0x06,0x01,0x02,0x01,0x00,0x00,0x02,0x01,0x00,0x10,0x00,0x01,0x08,0x01,0x02,0x01,0x00,0x11,0x04,0x01,0x02,0x01,0x00,0x20, 
  180.     0x00,0x02,0x00,0x12,0x18,0x01,0x08,0x01,0x02,0x01,0x00,0x21,0x02,0x01,0x00,0x22,0x02,0x01,0x00,0x30,0x00,0x03,0x04,0x01, 
  181.     0x02,0x01,0x00,0x31,0x00,0x13,0x04,0x01,0x02,0x01,0x00,0x32,0x00,0x23,0x04,0x01,0x02,0x01,0x00,0x40,0x00,0x04,0x02,0x01, 
  182.     0x00,0x41,0x00,0x14,0x1e,0x01,0x10,0x01,0x0a,0x01,0x04,0x01,0x02,0x01,0x00,0x42,0x00,0x24,0x04,0x01,0x02,0x01,0x00,0x33, 
  183.     0x00,0x43,0x00,0x50,0x04,0x01,0x02,0x01,0x00,0x34,0x00,0x51,0x00,0x61,0x06,0x01,0x02,0x01,0x00,0x16,0x02,0x01,0x00,0x06, 
  184.     0x00,0x26,0x02,0x01,0x00,0x62,0x02,0x01,0x00,0x15,0x02,0x01,0x00,0x05,0x00,0x52,0x10,0x01,0x0a,0x01,0x06,0x01,0x04,0x01, 
  185.     0x02,0x01,0x00,0x25,0x00,0x44,0x00,0x60,0x02,0x01,0x00,0x63,0x00,0x36,0x04,0x01,0x02,0x01,0x00,0x70,0x00,0x17,0x00,0x71, 
  186.     0x10,0x01,0x06,0x01,0x04,0x01,0x02,0x01,0x00,0x07,0x00,0x64,0x00,0x72,0x02,0x01,0x00,0x27,0x04,0x01,0x02,0x01,0x00,0x53, 
  187.     0x00,0x35,0x02,0x01,0x00,0x54,0x00,0x45,0x0a,0x01,0x04,0x01,0x02,0x01,0x00,0x46,0x00,0x73,0x02,0x01,0x00,0x37,0x02,0x01, 
  188.     0x00,0x65,0x00,0x56,0x0a,0x01,0x06,0x01,0x04,0x01,0x02,0x01,0x00,0x55,0x00,0x57,0x00,0x74,0x02,0x01,0x00,0x47,0x00,0x66, 
  189.     0x04,0x01,0x02,0x01,0x00,0x75,0x00,0x76,0x02,0x01,0x00,0x67,0x00,0x77, 
  190.     };
  191.  
  192.     static const uint8 table12[][2]={
  193.     0x0c,0x01,0x04,0x01,0x02,0x01,0x00,0x10,0x00,0x01,0x02,0x01,0x00,0x11,0x02,0x01,0x00,0x00,0x02,0x01,0x00,0x20,0x00,0x02, 
  194.     0x10,0x01,0x04,0x01,0x02,0x01,0x00,0x21,0x00,0x12,0x04,0x01,0x02,0x01,0x00,0x22,0x00,0x31,0x02,0x01,0x00,0x13,0x02,0x01, 
  195.     0x00,0x30,0x02,0x01,0x00,0x03,0x00,0x40,0x1a,0x01,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0x32,0x00,0x23,0x02,0x01,0x00,0x41, 
  196.     0x00,0x33,0x0a,0x01,0x04,0x01,0x02,0x01,0x00,0x14,0x00,0x42,0x02,0x01,0x00,0x24,0x02,0x01,0x00,0x04,0x00,0x50,0x04,0x01, 
  197.     0x02,0x01,0x00,0x43,0x00,0x34,0x02,0x01,0x00,0x51,0x00,0x15,0x1c,0x01,0x0e,0x01,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0x52, 
  198.     0x00,0x25,0x02,0x01,0x00,0x53,0x00,0x35,0x04,0x01,0x02,0x01,0x00,0x60,0x00,0x16,0x00,0x61,0x04,0x01,0x02,0x01,0x00,0x62, 
  199.     0x00,0x26,0x06,0x01,0x04,0x01,0x02,0x01,0x00,0x05,0x00,0x06,0x00,0x44,0x02,0x01,0x00,0x54,0x00,0x45,0x12,0x01,0x0a,0x01, 
  200.     0x04,0x01,0x02,0x01,0x00,0x63,0x00,0x36,0x04,0x01,0x02,0x01,0x00,0x70,0x00,0x07,0x00,0x71,0x04,0x01,0x02,0x01,0x00,0x17, 
  201.     0x00,0x64,0x02,0x01,0x00,0x46,0x00,0x72,0x0a,0x01,0x06,0x01,0x02,0x01,0x00,0x27,0x02,0x01,0x00,0x55,0x00,0x73,0x02,0x01, 
  202.     0x00,0x37,0x00,0x56,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0x65,0x00,0x74,0x02,0x01,0x00,0x47,0x00,0x66,0x04,0x01,0x02,0x01, 
  203.     0x00,0x75,0x00,0x57,0x02,0x01,0x00,0x76,0x02,0x01,0x00,0x67,0x00,0x77, 
  204.     };
  205.  
  206.     static const uint8 table13[][2]={
  207.     0x02,0x01,0x00,0x00,0x06,0x01,0x02,0x01,0x00,0x10,0x02,0x01,0x00,0x01,0x00,0x11,0x1c,0x01,0x08,0x01,0x04,0x01,0x02,0x01, 
  208.     0x00,0x20,0x00,0x02,0x02,0x01,0x00,0x21,0x00,0x12,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0x22,0x00,0x30,0x02,0x01,0x00,0x03, 
  209.     0x00,0x31,0x06,0x01,0x02,0x01,0x00,0x13,0x02,0x01,0x00,0x32,0x00,0x23,0x04,0x01,0x02,0x01,0x00,0x40,0x00,0x04,0x00,0x41, 
  210.     0x46,0x01,0x1c,0x01,0x0e,0x01,0x06,0x01,0x02,0x01,0x00,0x14,0x02,0x01,0x00,0x33,0x00,0x42,0x04,0x01,0x02,0x01,0x00,0x24, 
  211.     0x00,0x50,0x02,0x01,0x00,0x43,0x00,0x34,0x04,0x01,0x02,0x01,0x00,0x51,0x00,0x15,0x04,0x01,0x02,0x01,0x00,0x05,0x00,0x52, 
  212.     0x02,0x01,0x00,0x25,0x02,0x01,0x00,0x44,0x00,0x53,0x0e,0x01,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0x60,0x00,0x06,0x02,0x01, 
  213.     0x00,0x61,0x00,0x16,0x04,0x01,0x02,0x01,0x00,0x80,0x00,0x08,0x00,0x81,0x10,0x01,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0x35, 
  214.     0x00,0x62,0x02,0x01,0x00,0x26,0x00,0x54,0x04,0x01,0x02,0x01,0x00,0x45,0x00,0x63,0x02,0x01,0x00,0x36,0x00,0x70,0x06,0x01, 
  215.     0x04,0x01,0x02,0x01,0x00,0x07,0x00,0x55,0x00,0x71,0x02,0x01,0x00,0x17,0x02,0x01,0x00,0x27,0x00,0x37,0x48,0x01,0x18,0x01, 
  216.     0x0c,0x01,0x04,0x01,0x02,0x01,0x00,0x18,0x00,0x82,0x02,0x01,0x00,0x28,0x04,0x01,0x02,0x01,0x00,0x64,0x00,0x46,0x00,0x72, 
  217.     0x08,0x01,0x04,0x01,0x02,0x01,0x00,0x84,0x00,0x48,0x02,0x01,0x00,0x90,0x00,0x09,0x02,0x01,0x00,0x91,0x00,0x19,0x18,0x01, 
  218.     0x0e,0x01,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0x73,0x00,0x65,0x02,0x01,0x00,0x56,0x00,0x74,0x04,0x01,0x02,0x01,0x00,0x47, 
  219.     0x00,0x66,0x00,0x83,0x06,0x01,0x02,0x01,0x00,0x38,0x02,0x01,0x00,0x75,0x00,0x57,0x02,0x01,0x00,0x92,0x00,0x29,0x0e,0x01, 
  220.     0x08,0x01,0x04,0x01,0x02,0x01,0x00,0x67,0x00,0x85,0x02,0x01,0x00,0x58,0x00,0x39,0x02,0x01,0x00,0x93,0x02,0x01,0x00,0x49, 
  221.     0x00,0x86,0x06,0x01,0x02,0x01,0x00,0xa0,0x02,0x01,0x00,0x68,0x00,0x0a,0x02,0x01,0x00,0xa1,0x00,0x1a,0x44,0x01,0x18,0x01, 
  222.     0x0c,0x01,0x04,0x01,0x02,0x01,0x00,0xa2,0x00,0x2a,0x04,0x01,0x02,0x01,0x00,0x95,0x00,0x59,0x02,0x01,0x00,0xa3,0x00,0x3a, 
  223.     0x08,0x01,0x04,0x01,0x02,0x01,0x00,0x4a,0x00,0x96,0x02,0x01,0x00,0xb0,0x00,0x0b,0x02,0x01,0x00,0xb1,0x00,0x1b,0x14,0x01, 
  224.     0x08,0x01,0x02,0x01,0x00,0xb2,0x04,0x01,0x02,0x01,0x00,0x76,0x00,0x77,0x00,0x94,0x06,0x01,0x04,0x01,0x02,0x01,0x00,0x87, 
  225.     0x00,0x78,0x00,0xa4,0x04,0x01,0x02,0x01,0x00,0x69,0x00,0xa5,0x00,0x2b,0x0c,0x01,0x06,0x01,0x04,0x01,0x02,0x01,0x00,0x5a, 
  226.     0x00,0x88,0x00,0xb3,0x02,0x01,0x00,0x3b,0x02,0x01,0x00,0x79,0x00,0xa6,0x06,0x01,0x04,0x01,0x02,0x01,0x00,0x6a,0x00,0xb4, 
  227.     0x00,0xc0,0x04,0x01,0x02,0x01,0x00,0x0c,0x00,0x98,0x00,0xc1,0x3c,0x01,0x16,0x01,0x0a,0x01,0x06,0x01,0x02,0x01,0x00,0x1c, 
  228.     0x02,0x01,0x00,0x89,0x00,0xb5,0x02,0x01,0x00,0x5b,0x00,0xc2,0x04,0x01,0x02,0x01,0x00,0x2c,0x00,0x3c,0x04,0x01,0x02,0x01, 
  229.     0x00,0xb6,0x00,0x6b,0x02,0x01,0x00,0xc4,0x00,0x4c,0x10,0x01,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0xa8,0x00,0x8a,0x02,0x01, 
  230.     0x00,0xd0,0x00,0x0d,0x02,0x01,0x00,0xd1,0x02,0x01,0x00,0x4b,0x02,0x01,0x00,0x97,0x00,0xa7,0x0c,0x01,0x06,0x01,0x02,0x01, 
  231.     0x00,0xc3,0x02,0x01,0x00,0x7a,0x00,0x99,0x04,0x01,0x02,0x01,0x00,0xc5,0x00,0x5c,0x00,0xb7,0x04,0x01,0x02,0x01,0x00,0x1d, 
  232.     0x00,0xd2,0x02,0x01,0x00,0x2d,0x02,0x01,0x00,0x7b,0x00,0xd3,0x34,0x01,0x1c,0x01,0x0c,0x01,0x04,0x01,0x02,0x01,0x00,0x3d, 
  233.     0x00,0xc6,0x04,0x01,0x02,0x01,0x00,0x6c,0x00,0xa9,0x02,0x01,0x00,0x9a,0x00,0xd4,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0xb8, 
  234.     0x00,0x8b,0x02,0x01,0x00,0x4d,0x00,0xc7,0x04,0x01,0x02,0x01,0x00,0x7c,0x00,0xd5,0x02,0x01,0x00,0x5d,0x00,0xe0,0x0a,0x01, 
  235.     0x04,0x01,0x02,0x01,0x00,0xe1,0x00,0x1e,0x04,0x01,0x02,0x01,0x00,0x0e,0x00,0x2e,0x00,0xe2,0x08,0x01,0x04,0x01,0x02,0x01, 
  236.     0x00,0xe3,0x00,0x6d,0x02,0x01,0x00,0x8c,0x00,0xe4,0x04,0x01,0x02,0x01,0x00,0xe5,0x00,0xba,0x00,0xf0,0x26,0x01,0x10,0x01, 
  237.     0x04,0x01,0x02,0x01,0x00,0xf1,0x00,0x1f,0x06,0x01,0x04,0x01,0x02,0x01,0x00,0xaa,0x00,0x9b,0x00,0xb9,0x02,0x01,0x00,0x3e, 
  238.     0x02,0x01,0x00,0xd6,0x00,0xc8,0x0c,0x01,0x06,0x01,0x02,0x01,0x00,0x4e,0x02,0x01,0x00,0xd7,0x00,0x7d,0x02,0x01,0x00,0xab, 
  239.     0x02,0x01,0x00,0x5e,0x00,0xc9,0x06,0x01,0x02,0x01,0x00,0x0f,0x02,0x01,0x00,0x9c,0x00,0x6e,0x02,0x01,0x00,0xf2,0x00,0x2f, 
  240.     0x20,0x01,0x10,0x01,0x06,0x01,0x04,0x01,0x02,0x01,0x00,0xd8,0x00,0x8d,0x00,0x3f,0x06,0x01,0x02,0x01,0x00,0xf3,0x02,0x01, 
  241.     0x00,0xe6,0x00,0xca,0x02,0x01,0x00,0xf4,0x00,0x4f,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0xbb,0x00,0xac,0x02,0x01,0x00,0xe7, 
  242.     0x00,0xf5,0x04,0x01,0x02,0x01,0x00,0xd9,0x00,0x9d,0x02,0x01,0x00,0x5f,0x00,0xe8,0x1e,0x01,0x0c,0x01,0x06,0x01,0x02,0x01, 
  243.     0x00,0x6f,0x02,0x01,0x00,0xf6,0x00,0xcb,0x04,0x01,0x02,0x01,0x00,0xbc,0x00,0xad,0x00,0xda,0x08,0x01,0x02,0x01,0x00,0xf7, 
  244.     0x04,0x01,0x02,0x01,0x00,0x7e,0x00,0x7f,0x00,0x8e,0x06,0x01,0x04,0x01,0x02,0x01,0x00,0x9e,0x00,0xae,0x00,0xcc,0x02,0x01, 
  245.     0x00,0xf8,0x00,0x8f,0x12,0x01,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0xdb,0x00,0xbd,0x02,0x01,0x00,0xea,0x00,0xf9,0x04,0x01, 
  246.     0x02,0x01,0x00,0x9f,0x00,0xeb,0x02,0x01,0x00,0xbe,0x02,0x01,0x00,0xcd,0x00,0xfa,0x0e,0x01,0x04,0x01,0x02,0x01,0x00,0xdd, 
  247.     0x00,0xec,0x06,0x01,0x04,0x01,0x02,0x01,0x00,0xe9,0x00,0xaf,0x00,0xdc,0x02,0x01,0x00,0xce,0x00,0xfb,0x08,0x01,0x04,0x01, 
  248.     0x02,0x01,0x00,0xbf,0x00,0xde,0x02,0x01,0x00,0xcf,0x00,0xee,0x04,0x01,0x02,0x01,0x00,0xdf,0x00,0xef,0x02,0x01,0x00,0xff, 
  249.     0x02,0x01,0x00,0xed,0x02,0x01,0x00,0xfd,0x02,0x01,0x00,0xfc,0x00,0xfe, 
  250.     };
  251.  
  252.     static const uint8 table15[][2]={
  253.     0x10,0x01,0x06,0x01,0x02,0x01,0x00,0x00,0x02,0x01,0x00,0x10,0x00,0x01,0x02,0x01,0x00,0x11,0x04,0x01,0x02,0x01,0x00,0x20, 
  254.     0x00,0x02,0x02,0x01,0x00,0x21,0x00,0x12,0x32,0x01,0x10,0x01,0x06,0x01,0x02,0x01,0x00,0x22,0x02,0x01,0x00,0x30,0x00,0x31, 
  255.     0x06,0x01,0x02,0x01,0x00,0x13,0x02,0x01,0x00,0x03,0x00,0x40,0x02,0x01,0x00,0x32,0x00,0x23,0x0e,0x01,0x06,0x01,0x04,0x01, 
  256.     0x02,0x01,0x00,0x04,0x00,0x14,0x00,0x41,0x04,0x01,0x02,0x01,0x00,0x33,0x00,0x42,0x02,0x01,0x00,0x24,0x00,0x43,0x0a,0x01, 
  257.     0x06,0x01,0x02,0x01,0x00,0x34,0x02,0x01,0x00,0x50,0x00,0x05,0x02,0x01,0x00,0x51,0x00,0x15,0x04,0x01,0x02,0x01,0x00,0x52, 
  258.     0x00,0x25,0x04,0x01,0x02,0x01,0x00,0x44,0x00,0x53,0x00,0x61,0x5a,0x01,0x24,0x01,0x12,0x01,0x0a,0x01,0x06,0x01,0x02,0x01, 
  259.     0x00,0x35,0x02,0x01,0x00,0x60,0x00,0x06,0x02,0x01,0x00,0x16,0x00,0x62,0x04,0x01,0x02,0x01,0x00,0x26,0x00,0x54,0x02,0x01, 
  260.     0x00,0x45,0x00,0x63,0x0a,0x01,0x06,0x01,0x02,0x01,0x00,0x36,0x02,0x01,0x00,0x70,0x00,0x07,0x02,0x01,0x00,0x71,0x00,0x55, 
  261.     0x04,0x01,0x02,0x01,0x00,0x17,0x00,0x64,0x02,0x01,0x00,0x72,0x00,0x27,0x18,0x01,0x10,0x01,0x08,0x01,0x04,0x01,0x02,0x01, 
  262.     0x00,0x46,0x00,0x73,0x02,0x01,0x00,0x37,0x00,0x65,0x04,0x01,0x02,0x01,0x00,0x56,0x00,0x80,0x02,0x01,0x00,0x08,0x00,0x74, 
  263.     0x04,0x01,0x02,0x01,0x00,0x81,0x00,0x18,0x02,0x01,0x00,0x82,0x00,0x28,0x10,0x01,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0x47, 
  264.     0x00,0x66,0x02,0x01,0x00,0x83,0x00,0x38,0x04,0x01,0x02,0x01,0x00,0x75,0x00,0x57,0x02,0x01,0x00,0x84,0x00,0x48,0x06,0x01, 
  265.     0x04,0x01,0x02,0x01,0x00,0x90,0x00,0x19,0x00,0x91,0x04,0x01,0x02,0x01,0x00,0x92,0x00,0x76,0x02,0x01,0x00,0x67,0x00,0x29, 
  266.     0x5c,0x01,0x24,0x01,0x12,0x01,0x0a,0x01,0x04,0x01,0x02,0x01,0x00,0x85,0x00,0x58,0x04,0x01,0x02,0x01,0x00,0x09,0x00,0x77, 
  267.     0x00,0x93,0x04,0x01,0x02,0x01,0x00,0x39,0x00,0x94,0x02,0x01,0x00,0x49,0x00,0x86,0x0a,0x01,0x06,0x01,0x02,0x01,0x00,0x68, 
  268.     0x02,0x01,0x00,0xa0,0x00,0x0a,0x02,0x01,0x00,0xa1,0x00,0x1a,0x04,0x01,0x02,0x01,0x00,0xa2,0x00,0x2a,0x02,0x01,0x00,0x95, 
  269.     0x00,0x59,0x1a,0x01,0x0e,0x01,0x06,0x01,0x02,0x01,0x00,0xa3,0x02,0x01,0x00,0x3a,0x00,0x87,0x04,0x01,0x02,0x01,0x00,0x78, 
  270.     0x00,0xa4,0x02,0x01,0x00,0x4a,0x00,0x96,0x06,0x01,0x04,0x01,0x02,0x01,0x00,0x69,0x00,0xb0,0x00,0xb1,0x04,0x01,0x02,0x01, 
  271.     0x00,0x1b,0x00,0xa5,0x00,0xb2,0x0e,0x01,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0x5a,0x00,0x2b,0x02,0x01,0x00,0x88,0x00,0x97, 
  272.     0x02,0x01,0x00,0xb3,0x02,0x01,0x00,0x79,0x00,0x3b,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0x6a,0x00,0xb4,0x02,0x01,0x00,0x4b, 
  273.     0x00,0xc1,0x04,0x01,0x02,0x01,0x00,0x98,0x00,0x89,0x02,0x01,0x00,0x1c,0x00,0xb5,0x50,0x01,0x22,0x01,0x10,0x01,0x06,0x01, 
  274.     0x04,0x01,0x02,0x01,0x00,0x5b,0x00,0x2c,0x00,0xc2,0x06,0x01,0x04,0x01,0x02,0x01,0x00,0x0b,0x00,0xc0,0x00,0xa6,0x02,0x01, 
  275.     0x00,0xa7,0x00,0x7a,0x0a,0x01,0x04,0x01,0x02,0x01,0x00,0xc3,0x00,0x3c,0x04,0x01,0x02,0x01,0x00,0x0c,0x00,0x99,0x00,0xb6, 
  276.     0x04,0x01,0x02,0x01,0x00,0x6b,0x00,0xc4,0x02,0x01,0x00,0x4c,0x00,0xa8,0x14,0x01,0x0a,0x01,0x04,0x01,0x02,0x01,0x00,0x8a, 
  277.     0x00,0xc5,0x04,0x01,0x02,0x01,0x00,0xd0,0x00,0x5c,0x00,0xd1,0x04,0x01,0x02,0x01,0x00,0xb7,0x00,0x7b,0x02,0x01,0x00,0x1d, 
  278.     0x02,0x01,0x00,0x0d,0x00,0x2d,0x0c,0x01,0x04,0x01,0x02,0x01,0x00,0xd2,0x00,0xd3,0x04,0x01,0x02,0x01,0x00,0x3d,0x00,0xc6, 
  279.     0x02,0x01,0x00,0x6c,0x00,0xa9,0x06,0x01,0x04,0x01,0x02,0x01,0x00,0x9a,0x00,0xb8,0x00,0xd4,0x04,0x01,0x02,0x01,0x00,0x8b, 
  280.     0x00,0x4d,0x02,0x01,0x00,0xc7,0x00,0x7c,0x44,0x01,0x22,0x01,0x12,0x01,0x0a,0x01,0x04,0x01,0x02,0x01,0x00,0xd5,0x00,0x5d, 
  281.     0x04,0x01,0x02,0x01,0x00,0xe0,0x00,0x0e,0x00,0xe1,0x04,0x01,0x02,0x01,0x00,0x1e,0x00,0xe2,0x02,0x01,0x00,0xaa,0x00,0x2e, 
  282.     0x08,0x01,0x04,0x01,0x02,0x01,0x00,0xb9,0x00,0x9b,0x02,0x01,0x00,0xe3,0x00,0xd6,0x04,0x01,0x02,0x01,0x00,0x6d,0x00,0x3e, 
  283.     0x02,0x01,0x00,0xc8,0x00,0x8c,0x10,0x01,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0xe4,0x00,0x4e,0x02,0x01,0x00,0xd7,0x00,0x7d, 
  284.     0x04,0x01,0x02,0x01,0x00,0xe5,0x00,0xba,0x02,0x01,0x00,0xab,0x00,0x5e,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0xc9,0x00,0x9c, 
  285.     0x02,0x01,0x00,0xf1,0x00,0x1f,0x06,0x01,0x04,0x01,0x02,0x01,0x00,0xf0,0x00,0x6e,0x00,0xf2,0x02,0x01,0x00,0x2f,0x00,0xe6, 
  286.     0x26,0x01,0x12,0x01,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0xd8,0x00,0xf3,0x02,0x01,0x00,0x3f,0x00,0xf4,0x06,0x01,0x02,0x01, 
  287.     0x00,0x4f,0x02,0x01,0x00,0x8d,0x00,0xd9,0x02,0x01,0x00,0xbb,0x00,0xca,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0xac,0x00,0xe7, 
  288.     0x02,0x01,0x00,0x7e,0x00,0xf5,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0x9d,0x00,0x5f,0x02,0x01,0x00,0xe8,0x00,0x8e,0x02,0x01, 
  289.     0x00,0xf6,0x00,0xcb,0x22,0x01,0x12,0x01,0x0a,0x01,0x06,0x01,0x04,0x01,0x02,0x01,0x00,0x0f,0x00,0xae,0x00,0x6f,0x02,0x01, 
  290.     0x00,0xbc,0x00,0xda,0x04,0x01,0x02,0x01,0x00,0xad,0x00,0xf7,0x02,0x01,0x00,0x7f,0x00,0xe9,0x08,0x01,0x04,0x01,0x02,0x01, 
  291.     0x00,0x9e,0x00,0xcc,0x02,0x01,0x00,0xf8,0x00,0x8f,0x04,0x01,0x02,0x01,0x00,0xdb,0x00,0xbd,0x02,0x01,0x00,0xea,0x00,0xf9, 
  292.     0x10,0x01,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0x9f,0x00,0xdc,0x02,0x01,0x00,0xcd,0x00,0xeb,0x04,0x01,0x02,0x01,0x00,0xbe, 
  293.     0x00,0xfa,0x02,0x01,0x00,0xaf,0x00,0xdd,0x0e,0x01,0x06,0x01,0x04,0x01,0x02,0x01,0x00,0xec,0x00,0xce,0x00,0xfb,0x04,0x01, 
  294.     0x02,0x01,0x00,0xbf,0x00,0xed,0x02,0x01,0x00,0xde,0x00,0xfc,0x06,0x01,0x04,0x01,0x02,0x01,0x00,0xcf,0x00,0xfd,0x00,0xee, 
  295.     0x04,0x01,0x02,0x01,0x00,0xdf,0x00,0xfe,0x02,0x01,0x00,0xef,0x00,0xff, 
  296.     };
  297.  
  298.     static const uint8 table16[][2]={
  299.     0x02,0x01,0x00,0x00,0x06,0x01,0x02,0x01,0x00,0x10,0x02,0x01,0x00,0x01,0x00,0x11,0x2a,0x01,0x08,0x01,0x04,0x01,0x02,0x01, 
  300.     0x00,0x20,0x00,0x02,0x02,0x01,0x00,0x21,0x00,0x12,0x0a,0x01,0x06,0x01,0x02,0x01,0x00,0x22,0x02,0x01,0x00,0x30,0x00,0x03, 
  301.     0x02,0x01,0x00,0x31,0x00,0x13,0x0a,0x01,0x04,0x01,0x02,0x01,0x00,0x32,0x00,0x23,0x04,0x01,0x02,0x01,0x00,0x40,0x00,0x04, 
  302.     0x00,0x41,0x06,0x01,0x02,0x01,0x00,0x14,0x02,0x01,0x00,0x33,0x00,0x42,0x04,0x01,0x02,0x01,0x00,0x24,0x00,0x50,0x02,0x01, 
  303.     0x00,0x43,0x00,0x34,0x8a,0x01,0x28,0x01,0x10,0x01,0x06,0x01,0x04,0x01,0x02,0x01,0x00,0x05,0x00,0x15,0x00,0x51,0x04,0x01, 
  304.     0x02,0x01,0x00,0x52,0x00,0x25,0x04,0x01,0x02,0x01,0x00,0x44,0x00,0x35,0x00,0x53,0x0a,0x01,0x06,0x01,0x04,0x01,0x02,0x01, 
  305.     0x00,0x60,0x00,0x06,0x00,0x61,0x02,0x01,0x00,0x16,0x00,0x62,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0x26,0x00,0x54,0x02,0x01, 
  306.     0x00,0x45,0x00,0x63,0x04,0x01,0x02,0x01,0x00,0x36,0x00,0x70,0x00,0x71,0x28,0x01,0x12,0x01,0x08,0x01,0x02,0x01,0x00,0x17, 
  307.     0x02,0x01,0x00,0x07,0x02,0x01,0x00,0x55,0x00,0x64,0x04,0x01,0x02,0x01,0x00,0x72,0x00,0x27,0x04,0x01,0x02,0x01,0x00,0x46, 
  308.     0x00,0x65,0x00,0x73,0x0a,0x01,0x06,0x01,0x02,0x01,0x00,0x37,0x02,0x01,0x00,0x56,0x00,0x08,0x02,0x01,0x00,0x80,0x00,0x81, 
  309.     0x06,0x01,0x02,0x01,0x00,0x18,0x02,0x01,0x00,0x74,0x00,0x47,0x02,0x01,0x00,0x82,0x02,0x01,0x00,0x28,0x00,0x66,0x18,0x01, 
  310.     0x0e,0x01,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0x83,0x00,0x38,0x02,0x01,0x00,0x75,0x00,0x84,0x04,0x01,0x02,0x01,0x00,0x48, 
  311.     0x00,0x90,0x00,0x91,0x06,0x01,0x02,0x01,0x00,0x19,0x02,0x01,0x00,0x09,0x00,0x76,0x02,0x01,0x00,0x92,0x00,0x29,0x0e,0x01, 
  312.     0x08,0x01,0x04,0x01,0x02,0x01,0x00,0x85,0x00,0x58,0x02,0x01,0x00,0x93,0x00,0x39,0x04,0x01,0x02,0x01,0x00,0xa0,0x00,0x0a, 
  313.     0x00,0x1a,0x08,0x01,0x02,0x01,0x00,0xa2,0x02,0x01,0x00,0x67,0x02,0x01,0x00,0x57,0x00,0x49,0x06,0x01,0x02,0x01,0x00,0x94, 
  314.     0x02,0x01,0x00,0x77,0x00,0x86,0x02,0x01,0x00,0xa1,0x02,0x01,0x00,0x68,0x00,0x95,0xdc,0x01,0x7e,0x01,0x32,0x01,0x1a,0x01, 
  315.     0x0c,0x01,0x06,0x01,0x02,0x01,0x00,0x2a,0x02,0x01,0x00,0x59,0x00,0x3a,0x02,0x01,0x00,0xa3,0x02,0x01,0x00,0x87,0x00,0x78, 
  316.     0x08,0x01,0x04,0x01,0x02,0x01,0x00,0xa4,0x00,0x4a,0x02,0x01,0x00,0x96,0x00,0x69,0x04,0x01,0x02,0x01,0x00,0xb0,0x00,0x0b, 
  317.     0x00,0xb1,0x0a,0x01,0x04,0x01,0x02,0x01,0x00,0x1b,0x00,0xb2,0x02,0x01,0x00,0x2b,0x02,0x01,0x00,0xa5,0x00,0x5a,0x06,0x01, 
  318.     0x02,0x01,0x00,0xb3,0x02,0x01,0x00,0xa6,0x00,0x6a,0x04,0x01,0x02,0x01,0x00,0xb4,0x00,0x4b,0x02,0x01,0x00,0x0c,0x00,0xc1, 
  319.     0x1e,0x01,0x0e,0x01,0x06,0x01,0x04,0x01,0x02,0x01,0x00,0xb5,0x00,0xc2,0x00,0x2c,0x04,0x01,0x02,0x01,0x00,0xa7,0x00,0xc3, 
  320.     0x02,0x01,0x00,0x6b,0x00,0xc4,0x08,0x01,0x02,0x01,0x00,0x1d,0x04,0x01,0x02,0x01,0x00,0x88,0x00,0x97,0x00,0x3b,0x04,0x01, 
  321.     0x02,0x01,0x00,0xd1,0x00,0xd2,0x02,0x01,0x00,0x2d,0x00,0xd3,0x12,0x01,0x06,0x01,0x04,0x01,0x02,0x01,0x00,0x1e,0x00,0x2e, 
  322.     0x00,0xe2,0x06,0x01,0x04,0x01,0x02,0x01,0x00,0x79,0x00,0x98,0x00,0xc0,0x02,0x01,0x00,0x1c,0x02,0x01,0x00,0x89,0x00,0x5b, 
  323.     0x0e,0x01,0x06,0x01,0x02,0x01,0x00,0x3c,0x02,0x01,0x00,0x7a,0x00,0xb6,0x04,0x01,0x02,0x01,0x00,0x4c,0x00,0x99,0x02,0x01, 
  324.     0x00,0xa8,0x00,0x8a,0x06,0x01,0x02,0x01,0x00,0x0d,0x02,0x01,0x00,0xc5,0x00,0x5c,0x04,0x01,0x02,0x01,0x00,0x3d,0x00,0xc6, 
  325.     0x02,0x01,0x00,0x6c,0x00,0x9a,0x58,0x01,0x56,0x01,0x24,0x01,0x10,0x01,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0x8b,0x00,0x4d, 
  326.     0x02,0x01,0x00,0xc7,0x00,0x7c,0x04,0x01,0x02,0x01,0x00,0xd5,0x00,0x5d,0x02,0x01,0x00,0xe0,0x00,0x0e,0x08,0x01,0x02,0x01, 
  327.     0x00,0xe3,0x04,0x01,0x02,0x01,0x00,0xd0,0x00,0xb7,0x00,0x7b,0x06,0x01,0x04,0x01,0x02,0x01,0x00,0xa9,0x00,0xb8,0x00,0xd4, 
  328.     0x02,0x01,0x00,0xe1,0x02,0x01,0x00,0xaa,0x00,0xb9,0x18,0x01,0x0a,0x01,0x06,0x01,0x04,0x01,0x02,0x01,0x00,0x9b,0x00,0xd6, 
  329.     0x00,0x6d,0x02,0x01,0x00,0x3e,0x00,0xc8,0x06,0x01,0x04,0x01,0x02,0x01,0x00,0x8c,0x00,0xe4,0x00,0x4e,0x04,0x01,0x02,0x01, 
  330.     0x00,0xd7,0x00,0xe5,0x02,0x01,0x00,0xba,0x00,0xab,0x0c,0x01,0x04,0x01,0x02,0x01,0x00,0x9c,0x00,0xe6,0x04,0x01,0x02,0x01, 
  331.     0x00,0x6e,0x00,0xd8,0x02,0x01,0x00,0x8d,0x00,0xbb,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0xe7,0x00,0x9d,0x02,0x01,0x00,0xe8, 
  332.     0x00,0x8e,0x04,0x01,0x02,0x01,0x00,0xcb,0x00,0xbc,0x00,0x9e,0x00,0xf1,0x02,0x01,0x00,0x1f,0x02,0x01,0x00,0x0f,0x00,0x2f, 
  333.     0x42,0x01,0x38,0x01,0x02,0x01,0x00,0xf2,0x34,0x01,0x32,0x01,0x14,0x01,0x08,0x01,0x02,0x01,0x00,0xbd,0x02,0x01,0x00,0x5e, 
  334.     0x02,0x01,0x00,0x7d,0x00,0xc9,0x06,0x01,0x02,0x01,0x00,0xca,0x02,0x01,0x00,0xac,0x00,0x7e,0x04,0x01,0x02,0x01,0x00,0xda, 
  335.     0x00,0xad,0x00,0xcc,0x0a,0x01,0x06,0x01,0x02,0x01,0x00,0xae,0x02,0x01,0x00,0xdb,0x00,0xdc,0x02,0x01,0x00,0xcd,0x00,0xbe, 
  336.     0x06,0x01,0x04,0x01,0x02,0x01,0x00,0xeb,0x00,0xed,0x00,0xee,0x06,0x01,0x04,0x01,0x02,0x01,0x00,0xd9,0x00,0xea,0x00,0xe9, 
  337.     0x02,0x01,0x00,0xde,0x04,0x01,0x02,0x01,0x00,0xdd,0x00,0xec,0x00,0xce,0x00,0x3f,0x00,0xf0,0x04,0x01,0x02,0x01,0x00,0xf3, 
  338.     0x00,0xf4,0x02,0x01,0x00,0x4f,0x02,0x01,0x00,0xf5,0x00,0x5f,0x0a,0x01,0x02,0x01,0x00,0xff,0x04,0x01,0x02,0x01,0x00,0xf6, 
  339.     0x00,0x6f,0x02,0x01,0x00,0xf7,0x00,0x7f,0x0c,0x01,0x06,0x01,0x02,0x01,0x00,0x8f,0x02,0x01,0x00,0xf8,0x00,0xf9,0x04,0x01, 
  340.     0x02,0x01,0x00,0x9f,0x00,0xfa,0x00,0xaf,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0xfb,0x00,0xbf,0x02,0x01,0x00,0xfc,0x00,0xcf, 
  341.     0x04,0x01,0x02,0x01,0x00,0xfd,0x00,0xdf,0x02,0x01,0x00,0xfe,0x00,0xef, 
  342.     };
  343.  
  344.     static const uint8 table24[][2]={
  345.     0x3c,0x01,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0x00,0x00,0x10,0x02,0x01,0x00,0x01,0x00,0x11,0x0e,0x01,0x06,0x01,0x04,0x01, 
  346.     0x02,0x01,0x00,0x20,0x00,0x02,0x00,0x21,0x02,0x01,0x00,0x12,0x02,0x01,0x00,0x22,0x02,0x01,0x00,0x30,0x00,0x03,0x0e,0x01, 
  347.     0x04,0x01,0x02,0x01,0x00,0x31,0x00,0x13,0x04,0x01,0x02,0x01,0x00,0x32,0x00,0x23,0x04,0x01,0x02,0x01,0x00,0x40,0x00,0x04, 
  348.     0x00,0x41,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0x14,0x00,0x33,0x02,0x01,0x00,0x42,0x00,0x24,0x06,0x01,0x04,0x01,0x02,0x01, 
  349.     0x00,0x43,0x00,0x34,0x00,0x51,0x06,0x01,0x04,0x01,0x02,0x01,0x00,0x50,0x00,0x05,0x00,0x15,0x02,0x01,0x00,0x52,0x00,0x25, 
  350.     0xfa,0x01,0x62,0x01,0x22,0x01,0x12,0x01,0x0a,0x01,0x04,0x01,0x02,0x01,0x00,0x44,0x00,0x53,0x02,0x01,0x00,0x35,0x02,0x01, 
  351.     0x00,0x60,0x00,0x06,0x04,0x01,0x02,0x01,0x00,0x61,0x00,0x16,0x02,0x01,0x00,0x62,0x00,0x26,0x08,0x01,0x04,0x01,0x02,0x01, 
  352.     0x00,0x54,0x00,0x45,0x02,0x01,0x00,0x63,0x00,0x36,0x04,0x01,0x02,0x01,0x00,0x71,0x00,0x55,0x02,0x01,0x00,0x64,0x00,0x46, 
  353.     0x20,0x01,0x0e,0x01,0x06,0x01,0x02,0x01,0x00,0x72,0x02,0x01,0x00,0x27,0x00,0x37,0x02,0x01,0x00,0x73,0x04,0x01,0x02,0x01, 
  354.     0x00,0x70,0x00,0x07,0x00,0x17,0x0a,0x01,0x04,0x01,0x02,0x01,0x00,0x65,0x00,0x56,0x04,0x01,0x02,0x01,0x00,0x80,0x00,0x08, 
  355.     0x00,0x81,0x04,0x01,0x02,0x01,0x00,0x74,0x00,0x47,0x02,0x01,0x00,0x18,0x00,0x82,0x10,0x01,0x08,0x01,0x04,0x01,0x02,0x01, 
  356.     0x00,0x28,0x00,0x66,0x02,0x01,0x00,0x83,0x00,0x38,0x04,0x01,0x02,0x01,0x00,0x75,0x00,0x57,0x02,0x01,0x00,0x84,0x00,0x48, 
  357.     0x08,0x01,0x04,0x01,0x02,0x01,0x00,0x91,0x00,0x19,0x02,0x01,0x00,0x92,0x00,0x76,0x04,0x01,0x02,0x01,0x00,0x67,0x00,0x29, 
  358.     0x02,0x01,0x00,0x85,0x00,0x58,0x5c,0x01,0x22,0x01,0x10,0x01,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0x93,0x00,0x39,0x02,0x01, 
  359.     0x00,0x94,0x00,0x49,0x04,0x01,0x02,0x01,0x00,0x77,0x00,0x86,0x02,0x01,0x00,0x68,0x00,0xa1,0x08,0x01,0x04,0x01,0x02,0x01, 
  360.     0x00,0xa2,0x00,0x2a,0x02,0x01,0x00,0x95,0x00,0x59,0x04,0x01,0x02,0x01,0x00,0xa3,0x00,0x3a,0x02,0x01,0x00,0x87,0x02,0x01, 
  361.     0x00,0x78,0x00,0x4a,0x16,0x01,0x0c,0x01,0x04,0x01,0x02,0x01,0x00,0xa4,0x00,0x96,0x04,0x01,0x02,0x01,0x00,0x69,0x00,0xb1, 
  362.     0x02,0x01,0x00,0x1b,0x00,0xa5,0x06,0x01,0x02,0x01,0x00,0xb2,0x02,0x01,0x00,0x5a,0x00,0x2b,0x02,0x01,0x00,0x88,0x00,0xb3, 
  363.     0x10,0x01,0x0a,0x01,0x06,0x01,0x02,0x01,0x00,0x90,0x02,0x01,0x00,0x09,0x00,0xa0,0x02,0x01,0x00,0x97,0x00,0x79,0x04,0x01, 
  364.     0x02,0x01,0x00,0xa6,0x00,0x6a,0x00,0xb4,0x0c,0x01,0x06,0x01,0x02,0x01,0x00,0x1a,0x02,0x01,0x00,0x0a,0x00,0xb0,0x02,0x01, 
  365.     0x00,0x3b,0x02,0x01,0x00,0x0b,0x00,0xc0,0x04,0x01,0x02,0x01,0x00,0x4b,0x00,0xc1,0x02,0x01,0x00,0x98,0x00,0x89,0x43,0x01, 
  366.     0x22,0x01,0x10,0x01,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0x1c,0x00,0xb5,0x02,0x01,0x00,0x5b,0x00,0xc2,0x04,0x01,0x02,0x01, 
  367.     0x00,0x2c,0x00,0xa7,0x02,0x01,0x00,0x7a,0x00,0xc3,0x0a,0x01,0x06,0x01,0x02,0x01,0x00,0x3c,0x02,0x01,0x00,0x0c,0x00,0xd0, 
  368.     0x02,0x01,0x00,0xb6,0x00,0x6b,0x04,0x01,0x02,0x01,0x00,0xc4,0x00,0x4c,0x02,0x01,0x00,0x99,0x00,0xa8,0x10,0x01,0x08,0x01, 
  369.     0x04,0x01,0x02,0x01,0x00,0x8a,0x00,0xc5,0x02,0x01,0x00,0x5c,0x00,0xd1,0x04,0x01,0x02,0x01,0x00,0xb7,0x00,0x7b,0x02,0x01, 
  370.     0x00,0x1d,0x00,0xd2,0x09,0x01,0x04,0x01,0x02,0x01,0x00,0x2d,0x00,0xd3,0x02,0x01,0x00,0x3d,0x00,0xc6,0x55,0xfa,0x04,0x01, 
  371.     0x02,0x01,0x00,0x6c,0x00,0xa9,0x02,0x01,0x00,0x9a,0x00,0xd4,0x20,0x01,0x10,0x01,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0xb8, 
  372.     0x00,0x8b,0x02,0x01,0x00,0x4d,0x00,0xc7,0x04,0x01,0x02,0x01,0x00,0x7c,0x00,0xd5,0x02,0x01,0x00,0x5d,0x00,0xe1,0x08,0x01, 
  373.     0x04,0x01,0x02,0x01,0x00,0x1e,0x00,0xe2,0x02,0x01,0x00,0xaa,0x00,0xb9,0x04,0x01,0x02,0x01,0x00,0x9b,0x00,0xe3,0x02,0x01, 
  374.     0x00,0xd6,0x00,0x6d,0x14,0x01,0x0a,0x01,0x06,0x01,0x02,0x01,0x00,0x3e,0x02,0x01,0x00,0x2e,0x00,0x4e,0x02,0x01,0x00,0xc8, 
  375.     0x00,0x8c,0x04,0x01,0x02,0x01,0x00,0xe4,0x00,0xd7,0x04,0x01,0x02,0x01,0x00,0x7d,0x00,0xab,0x00,0xe5,0x0a,0x01,0x04,0x01, 
  376.     0x02,0x01,0x00,0xba,0x00,0x5e,0x02,0x01,0x00,0xc9,0x02,0x01,0x00,0x9c,0x00,0x6e,0x08,0x01,0x02,0x01,0x00,0xe6,0x02,0x01, 
  377.     0x00,0x0d,0x02,0x01,0x00,0xe0,0x00,0x0e,0x04,0x01,0x02,0x01,0x00,0xd8,0x00,0x8d,0x02,0x01,0x00,0xbb,0x00,0xca,0x4a,0x01, 
  378.     0x02,0x01,0x00,0xff,0x40,0x01,0x3a,0x01,0x20,0x01,0x10,0x01,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0xac,0x00,0xe7,0x02,0x01, 
  379.     0x00,0x7e,0x00,0xd9,0x04,0x01,0x02,0x01,0x00,0x9d,0x00,0xe8,0x02,0x01,0x00,0x8e,0x00,0xcb,0x08,0x01,0x04,0x01,0x02,0x01, 
  380.     0x00,0xbc,0x00,0xda,0x02,0x01,0x00,0xad,0x00,0xe9,0x04,0x01,0x02,0x01,0x00,0x9e,0x00,0xcc,0x02,0x01,0x00,0xdb,0x00,0xbd, 
  381.     0x10,0x01,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0xea,0x00,0xae,0x02,0x01,0x00,0xdc,0x00,0xcd,0x04,0x01,0x02,0x01,0x00,0xeb, 
  382.     0x00,0xbe,0x02,0x01,0x00,0xdd,0x00,0xec,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0xce,0x00,0xed,0x02,0x01,0x00,0xde,0x00,0xee, 
  383.     0x00,0x0f,0x04,0x01,0x02,0x01,0x00,0xf0,0x00,0x1f,0x00,0xf1,0x04,0x01,0x02,0x01,0x00,0xf2,0x00,0x2f,0x02,0x01,0x00,0xf3, 
  384.     0x00,0x3f,0x12,0x01,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0xf4,0x00,0x4f,0x02,0x01,0x00,0xf5,0x00,0x5f,0x04,0x01,0x02,0x01, 
  385.     0x00,0xf6,0x00,0x6f,0x02,0x01,0x00,0xf7,0x02,0x01,0x00,0x7f,0x00,0x8f,0x0a,0x01,0x04,0x01,0x02,0x01,0x00,0xf8,0x00,0xf9, 
  386.     0x04,0x01,0x02,0x01,0x00,0x9f,0x00,0xaf,0x00,0xfa,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0xfb,0x00,0xbf,0x02,0x01,0x00,0xfc, 
  387.     0x00,0xcf,0x04,0x01,0x02,0x01,0x00,0xfd,0x00,0xdf,0x02,0x01,0x00,0xfe,0x00,0xef, 
  388.     };
  389.  
  390.     static const uint8 table32[][2]={
  391.     0x02,0x01,0x00,0x00,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0x08,0x00,0x04,0x02,0x01,0x00,0x01,0x00,0x02,0x08,0x01,0x04,0x01, 
  392.     0x02,0x01,0x00,0x0c,0x00,0x0a,0x02,0x01,0x00,0x03,0x00,0x06,0x06,0x01,0x02,0x01,0x00,0x09,0x02,0x01,0x00,0x05,0x00,0x07, 
  393.     0x04,0x01,0x02,0x01,0x00,0x0e,0x00,0x0d,0x02,0x01,0x00,0x0f,0x00,0x0b, 
  394.     };
  395.  
  396.     static const uint8 table33[][2]={
  397.     0x10,0x01,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0x00,0x00,0x01,0x02,0x01,0x00,0x02,0x00,0x03,0x04,0x01,0x02,0x01,0x00,0x04, 
  398.     0x00,0x05,0x02,0x01,0x00,0x06,0x00,0x07,0x08,0x01,0x04,0x01,0x02,0x01,0x00,0x08,0x00,0x09,0x02,0x01,0x00,0x0a,0x00,0x0b, 
  399.     0x04,0x01,0x02,0x01,0x00,0x0c,0x00,0x0d,0x02,0x01,0x00,0x0e,0x00,0x0f, 
  400.     };
  401.  
  402.     static const unsigned hufftbl_15_shortcut[8]={        // starting node for 000..111
  403.         156,
  404.         67,
  405.         33,
  406.         18,
  407.         9,
  408.         8,
  409.         4,
  410.         3,
  411.     };
  412.  
  413.     static const unsigned hufftbl_24_shortcut[16]={        // starting node for 0000..1111
  414.         487, 470, 398, 397,
  415.         251, 160, 96, 63,
  416.         37, 24, 16, 11,
  417.         8, 7, 5, 4
  418.     };
  419. }
  420.  
  421. const VDMPEGAudioDecoder::L3HuffmanTableDescriptor VDMPEGAudioDecoder::sL3HuffmanTables[]={
  422.     { NULL,      0,  0,  0 },
  423.     { table1,    7,  2,  0 },
  424.     { table2,   17,  3,  0 },
  425.     { table3,   17,  3,  0 },
  426.     { NULL,      0,  0,  0 },
  427.     { table5,   31,  4,  0 },
  428.     { table6,   31,  4,  0 },
  429.     { table7,   71,  6,  0 },
  430.     { table8,   71,  6,  0 },
  431.     { table9,   71,  6,  0 },
  432.     { table10, 127,  8,  0 },
  433.     { table11, 127,  8,  0 },
  434.     { table12, 127,  8,  0 },
  435.     { table13, 511, 16,  0 },
  436.     { NULL,      0,  0,  0 },
  437.     { table15, 511, 16,  0 },
  438.     { table16, 511, 16,  1 },
  439.     { table16, 511, 16,  2 },
  440.     { table16, 511, 16,  3 },
  441.     { table16, 511, 16,  4 },
  442.     { table16, 511, 16,  6 },
  443.     { table16, 511, 16,  8 },
  444.     { table16, 511, 16, 10 },
  445.     { table16, 511, 16, 13 },
  446.     { table24, 512, 16,  4 },
  447.     { table24, 512, 16,  5 },
  448.     { table24, 512, 16,  6 },
  449.     { table24, 512, 16,  7 },
  450.     { table24, 512, 16,  8 },
  451.     { table24, 512, 16,  9 },
  452.     { table24, 512, 16, 11 },
  453.     { table24, 512, 16, 13 },
  454.     { table32, 0, 0, 0 },
  455.     { table33, 0, 0, 0 },
  456. };
  457.  
  458. #ifdef _M_AMD64
  459.  
  460.     extern "C" uint64 __rdtsc();
  461.     #pragma intrinsic(__rdtsc)
  462.  
  463.     static inline uint64 rdtsc() {
  464.         return __rdtsc();
  465.     }
  466. #else
  467.     #pragma warning(push)
  468.     #pragma warning(disable: 4035)        // warning C4035: 'rdtsc': no return value
  469.     static inline uint64 rdtsc() {
  470.         __asm {
  471.             rdtsc
  472.         }
  473.     }
  474.     #pragma warning(pop)
  475. #endif
  476.  
  477. void VDMPEGAudioDecoder::DecodeHuffmanValues(VDMPEGAudioHuffBitReader& bitreader, sint32 *dst, unsigned tableid, unsigned pairs) {
  478. #if 0
  479.     unsigned foo[8];
  480.     for(int i=0; i<8; ++i) {
  481.         unsigned j=0;
  482.  
  483.         j += table15[j][(i>>0)&1];
  484.         j += table15[j][(i>>1)&1];
  485.         j += table15[j][(i>>2)&1];
  486.         foo[i] = j;
  487.     }
  488.  
  489.     __asm int 3
  490. #endif
  491.  
  492.     if (!tableid) {
  493.         while(pairs-- > 0) {
  494.             *dst++ = 0;
  495.             *dst++ = 0;
  496.         }
  497.         return;
  498.     }
  499.  
  500.     VDMPEGAudioHuffBitReader bits(bitreader);
  501.  
  502.     const L3HuffmanTableDescriptor& tableinfo = sL3HuffmanTables[tableid];
  503.  
  504.     const uint8 (*const table)[2] = tableinfo.table;
  505.     const unsigned xybits = tableinfo.bits;
  506.     const unsigned linbits = tableinfo.linbits;
  507.  
  508. #ifdef RDTSC_PROFILE
  509.     static uint64 ticks[32]={0};
  510.  
  511.     ticks[tableid] -= rdtsc();
  512. #endif
  513.  
  514.     if (tableid == 1) {
  515.         while(pairs-- > 0) {
  516.             int v;
  517.  
  518.             v = bits.peek(5);
  519.             bits.consume(hufftbl_1_fast[v].bits);
  520.  
  521.             dst[0] = hufftbl_1_fast[v].x;
  522.             dst[1] = hufftbl_1_fast[v].y;
  523.             dst+=2;
  524.         }
  525.     } else if (tableid == 2) {
  526.         while(pairs-- > 0) {
  527.             int v;
  528.  
  529.             v = bits.peek(5);
  530.             if (v < 4) {
  531.                 v = bits.peek(8);
  532.                 bits.consume(hufftbl_2_3_hi[v].bits);
  533.  
  534.                 dst[0] = hufftbl_2_3_hi[v].x;
  535.                 dst[1] = hufftbl_2_3_hi[v].y;
  536.             } else {
  537.                 bits.consume(hufftbl_2_lo[v-4].bits);
  538.  
  539.                 dst[0] = hufftbl_2_lo[v-4].x;
  540.                 dst[1] = hufftbl_2_lo[v-4].y;
  541.             }
  542.             dst+=2;
  543.         }
  544.     } else if (tableid == 3) {
  545.         while(pairs-- > 0) {
  546.             int v;
  547.  
  548.             v = bits.peek(4);
  549.             if (v < 2) {
  550.                 v = bits.peek(8);
  551.                 bits.consume(hufftbl_2_3_hi[v].bits);
  552.  
  553.                 dst[0] = hufftbl_2_3_hi[v].x;
  554.                 dst[1] = hufftbl_2_3_hi[v].y;
  555.             } else {
  556.                 bits.consume(hufftbl_3_lo[v-2].bits);
  557.  
  558.                 dst[0] = hufftbl_3_lo[v-2].x;
  559.                 dst[1] = hufftbl_3_lo[v-2].y;
  560.             }
  561.             dst+=2;
  562.         }
  563.     } else if (tableid == 5) {
  564.         while(pairs-- > 0) {
  565.             unsigned v = bits.peek(5);
  566.  
  567.             if (v >= 4) {
  568.                 bits.consume(hufftbl_5_hi[v-4].bits);
  569.  
  570.                 dst[0] = hufftbl_5_hi[v-4].x;
  571.                 dst[1] = hufftbl_5_hi[v-4].y;
  572.             } else {
  573.                 bits.consume(3);
  574.  
  575.                 unsigned idx = 8;
  576.  
  577.                 while(table5[idx][0]) {
  578.                     unsigned i = bits.get(1);
  579.  
  580.                     idx += table5[idx][i];
  581.                 }
  582.  
  583.                 int x = table5[idx][1] >> 4;
  584.                 int y = table5[idx][1] & 15;
  585.  
  586.                 if (x && bits.getbit())
  587.                     x = -x;
  588.  
  589.                 if (y && bits.getbit())
  590.                     y = -y;
  591.  
  592.                 dst[0] = x;
  593.                 dst[1] = y;
  594.             }
  595.  
  596.             dst += 2;
  597.         }
  598.     } else if (tableid == 6) {
  599.         while(pairs-- > 0) {
  600.             unsigned v = bits.peek(6);
  601.  
  602.             if (v >= 10) {
  603.                 bits.consume(hufftbl_6_hi[v-10].bits);
  604.  
  605.                 dst[0] = hufftbl_6_hi[v-10].x;
  606.                 dst[1] = hufftbl_6_hi[v-10].y;
  607.             } else {
  608.                 bits.consume(2);
  609.  
  610.                 unsigned idx = 12;
  611.  
  612.                 while(table6[idx][0]) {
  613.                     unsigned i = bits.get(1);
  614.  
  615.                     idx += table6[idx][i];
  616.                 }
  617.  
  618.                 int x = table6[idx][1] >> 4;
  619.                 int y = table6[idx][1] & 15;
  620.  
  621.                 if (x && bits.getbit())
  622.                     x = -x;
  623.  
  624.                 if (y && bits.getbit())
  625.                     y = -y;
  626.  
  627.                 dst[0] = x;
  628.                 dst[1] = y;
  629.             }
  630.  
  631.             dst += 2;
  632.         }
  633.     } else if (tableid == 15) {
  634.         while(pairs-- > 0) {
  635.             unsigned idx = hufftbl_15_shortcut[bits.get(3)];
  636.  
  637.             while(table[idx][0]) {
  638.                 unsigned i = bits.get(1);
  639.  
  640.                 idx += table15[idx][i];
  641.             }
  642.  
  643.             int x = table15[idx][1] >> 4;
  644.             int y = table15[idx][1] & 15;
  645.  
  646.             if (x && bits.getbit())
  647.                 x = -x;
  648.  
  649.             if (y && bits.getbit())
  650.                 y = -y;
  651.  
  652.             dst[0] = x;
  653.             dst[1] = y;
  654.             dst += 2;
  655.         }
  656.     } else if (tableid >= 24) {
  657.         while(pairs-- > 0) {
  658.             unsigned idx = hufftbl_24_shortcut[bits.get(4)];
  659.  
  660.             while(table[idx][0]) {
  661.                 unsigned delta;
  662.                 unsigned i = bits.get(1);
  663.  
  664.                 do {
  665.                     idx += delta = table[idx][i];
  666.                 } while(delta >= 250);
  667.             }
  668.  
  669.             int x = table[idx][1] >> 4;
  670.             int y = table[idx][1] & 15;
  671.  
  672.             if (x == 15)
  673.                 x += bits.get(linbits);
  674.  
  675.             if (x && bits.getbit())
  676.                 x = -x;
  677.  
  678.             if (y == 15)
  679.                 y += bits.get(linbits);
  680.  
  681.             if (y && bits.getbit())
  682.                 y = -y;
  683.  
  684.             dst[0] = x;
  685.             dst[1] = y;
  686.             dst += 2;
  687.         }
  688.     } else if (linbits) {
  689.         while(pairs-- > 0) {
  690.             unsigned idx = 0;
  691.  
  692.             while(table[idx][0]) {
  693.                 unsigned i = bits.get(1);
  694.  
  695.                 idx += table[idx][i];
  696.             }
  697.  
  698.             int x = table[idx][1] >> 4;
  699.             int y = table[idx][1] & 15;
  700.  
  701.             if (x == 15 && linbits)
  702.                 x += bits.get(linbits);
  703.  
  704.             if (x && bits.getbit())
  705.                 x = -x;
  706.  
  707.             if (y == 15 && linbits)
  708.                 y += bits.get(linbits);
  709.  
  710.             if (y && bits.getbit())
  711.                 y = -y;
  712.  
  713.             dst[0] = x;
  714.             dst[1] = y;
  715.             dst += 2;
  716.         }
  717.     } else {
  718.         while(pairs-- > 0) {
  719.             unsigned idx = 0;
  720.  
  721.             while(table[idx][0]) {
  722.                 unsigned i = bits.get(1);
  723.  
  724.                 idx += table[idx][i];
  725.             }
  726.  
  727.             int x = table[idx][1] >> 4;
  728.             int y = table[idx][1] & 15;
  729.  
  730.             if (x && bits.getbit())
  731.                 x = -x;
  732.  
  733.             if (y && bits.getbit())
  734.                 y = -y;
  735.  
  736.             dst[0] = x;
  737.             dst[1] = y;
  738.             dst += 2;
  739.         }
  740.     }
  741.     bitreader = bits;
  742.  
  743. #ifdef RDTSC_PROFILE
  744.     ticks[tableid] += rdtsc();
  745.  
  746.     static int times = 0;
  747.  
  748.     if (++times == 4096) {
  749.         times = 0;
  750.  
  751.         static char buf[1024];
  752.  
  753.         for(int i=0; i<32; ++i) {
  754.             wsprintf(buf, "table %2d: %u ticks\n",i, (unsigned)ticks[i]);
  755.             OutputDebugString(buf);
  756.             ticks[i] = 0;
  757.         }
  758.     }
  759. #endif
  760. }
  761.